// 获取网络请求模块
var http = require("../../utils/http.js");
// 获取应用实例
const app = getApp()

Page({
  data:{
    indicatorDots: true,
    indicatorColor: '#d1e5fb',
    indicatorActiveColor: '#ff4444',
    autoplay: true,
    interval: 2000,
    duration: 1000,
    indexImgs: [
      {"imgUrl":"https://img.mall4j.com/2019/04/52b0082c60c04fc99dd03288548f2841.dpg"},
      {"imgUrl":"https://img.mall4j.com/2019/04/c2d830afc56d469f96825e91e464d155.jpg"},
      {"imgUrl":"https://img.mall4j.com/2019/04/f676a8a8dbcb4e5c9bc907ef059aedb9.jpg"}
    ],
    news: [
      {"id":3,"title":"最新iPhone15上新了！！速度抢购"},
      {"id":2,"title":"华为Meta60已上架，限时抢购"},
      {"id":3,"title":"全场衣服打5折，速领优惠卷"}
    ],
    prods:[{"shopId":null,"shopName":"mall4j小店1","prodId":18,"prodName":"Apple iPhone XS Max 移动联通电信4G手机 ","price":1.01,"content":null,"oriPrice":null,"totalStocks":null,"brief":"6.5英寸大屏，支持双卡。","pic":"https://img.mall4j.com/2019/04/eaa8c9bd3e7b41eaa310adbde10b6401.jpg","imgs":null,"categoryId":null,"skuList":null,"transport":null},{"shopId":null,"shopName":"mall4j小店1","prodId":70,"prodName":"【Dole都乐】比利时Truval啤梨12只 进口水果新鲜梨 单果120g左右","price":38.0,"content":null,"oriPrice":null,"totalStocks":null,"brief":"好吃","pic":"https://img.mall4j.com/2019/04/de0edd2aaf2d4d3c8b6c3fdfde738805.jpg","imgs":null,"categoryId":null,"skuList":null,"transport":null},{"shopId":null,"shopName":"mall4j小店1","prodId":75,"prodName":"测试商品A","price":30.0,"content":null,"oriPrice":null,"totalStocks":null,"brief":"AAA","pic":"https://img.mall4j.com/2019/05/65525bbccee04ec5a094f38ce61d6b86.jpg","imgs":null,"categoryId":null,"skuList":null,"transport":null},{"shopId":null,"shopName":"mall4j小店1","prodId":77,"prodName":"测试商品C","price":50.0,"content":null,"oriPrice":null,"totalStocks":null,"brief":"CCC","pic":"https://img.mall4j.com/2019/05/1bdd097dbffd477799a7aca949377b20.jpg","imgs":null,"categoryId":null,"skuList":null,"transport":null},{"shopId":null,"shopName":null,"prodId":74,"prodName":"旺仔牛奶","price":100.0,"content":null,"oriPrice":null,"totalStocks":null,"brief":"测试","pic":"https://img.mall4j.com/2019/05/b1a4bf7612554dbc8395f22e22d531c8.jpg","imgs":null,"categoryId":null,"skuList":null,"transport":null}]
  },
  onShow(){
    http.getCartCount()
  },
  toProdPage(e){
    let that = this
    wx.navigateTo({
      url: "../detail/detail",
      success:function(res) {
        res.eventChannel.emit("mydata",that.data.prods[e.currentTarget.dataset.indx])
      }
    })
  }
})
